#ifndef SIMS_H
#define SIMS_H

#include <QKeyEvent>
#include <QLabel>
#include <QList>
#include <QMainWindow>
#include <QTableWidget>

#include "core/sims_core.h"

QT_BEGIN_NAMESPACE
namespace Ui
{
    class SIMS;
}
QT_END_NAMESPACE

class SIMS : public QMainWindow
{
    Q_OBJECT

public:
    SIMS(QWidget *parent = nullptr);
    ~SIMS();

    void readTXT(const string filePath); // 读取TXT数据
    void readExcel(const QString filePath); // 读取Excel数据

    std::string UnicodetoLocale(QString _filePath);

    void setStatusNum(int num); // 设置状态栏学生数量

    void drawPassRateCharts();  // 绘制各科及格率条形图
    void drawScoreRateCharts(); // 绘制各科各分数层百分比条形图

private:
    void createNewTable(QWidget *tab_, int i); // 绘制新表格

private slots:
    void on_action_Add_triggered();

    void on_addTable_clicked();

    void on_tabWidget_tabCloseRequested(int index);

    void on_actionTXT_2_triggered();

    void on_actionBinary_triggered();

    void on_tabWidget_tabBarClicked(int index);

    void on_actionExcel_3_triggered();

protected:
    virtual void dragEnterEvent(QDragEnterEvent *event); // 拖动进入事件
    virtual void dropEvent(QDropEvent *event);           // 放下事件

private:
    bool isAddTable = 0;
    Ui::SIMS *ui;
    QString filePath;
    QList<QTableWidget *> tableList;
    vector<StudentListType *> StudentLists;
    vector<StudentParameterType *> StuParameters;

    QLabel *labStudNum;   //状态栏学生数量
};
#endif // SIMS_H
